package com.itheima.reggie.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.reggie.commom.ResultInfo;
import com.itheima.reggie.domain.Order;
import com.itheima.reggie.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;


/**
 * @author hasee
 * @date 2023/3/11 15:18
 */
@Api(tags = "订单明细")
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;
    @ApiOperation("后台订单明细")
    //后台订单明细
    @GetMapping("/page")
    public ResultInfo page(@RequestParam(value = "page",defaultValue = "1") Integer page,
                           @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
                           String number,
                           @DateTimeFormat LocalDate beginTime,
                           @DateTimeFormat  LocalDate endTime){
        Page<Order> pageNum = orderService.page(page,pageSize,number,beginTime,endTime);
        return ResultInfo.success(pageNum);
    }
}
